#include "IntegerField.h"

IntegerField::IntegerField(const QString &name, int lenght)
    : BaseField(name, lenght)
{
    _typeName = "IntegerField";
}

IntegerField::IntegerField(const QString &name, const QString &description, int lenght)
    : BaseField(name, description, lenght)
{
    _typeName = "IntegerField";
}

// IClassifierField imlemented
bool IntegerField::validate(const QVariant &value) const
{
    bool ok = false;

    value.toInt(&ok);

    if(ok && value.toString().length() <= _lenght)
        return true;

    return false;
}
